package cn.wolfcode;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableDiscoveryClient  // 开启nacos服务，将服务信息推送到注册中心中
@EnableFeignClients     // 开启远程调用，解决微服务架构服务调用的问题
                        //扫描注解,注意扫描路径(默认扫描当前包及其子包)
public class OrderServerApp {
    public static void main(String[] args) {
        SpringApplication.run(OrderServerApp.class,args);
    }

    @Bean
    @LoadBalanced   // 开启springcloudAlibaba 的负载均衡组件 Ribbon
    public RestTemplate template(){
        return new RestTemplate();
    }
}
